<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li :class="{completed : item.isDone}" v-for="item in list" :key="item.id">
      <!-- 循环生成li，将复选框跟item.isdone双向绑定，设置动态类名，根据数据的isdone判定是否显示样式 -->
      <div class="view" > 
        <input class="toggle" type="checkbox" v-model="item.isDone"/>
        <label>{{item.name}}</label>
        <button class="destroy" @click="$emit('delTask',item.id)"></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
export default {
  props: ['list'],//接受父组件的数据，展示到页面上
  methods: {
   
  }
}
</script>